package com.budwk.app.sys.services.impl;

import com.budwk.app.sys.models.SmsMsgDTO;
import com.budwk.app.sys.services.OpaSmsService;
import com.budwk.app.sys.services.TenYuSmsService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;

/**
 * @author ZY.Wang
 * @since 2023/5/30
 */
@IocBean
public class OpaSmsServiceImpl implements OpaSmsService {

    private static final String sendMessageUrl = "https://opassapi.infocloud.cc/sms/Api/Send.do";

    @Inject
    private TenYuSmsService tenYuSmsService;

    public Integer opaSmsSendOneMessage(SmsMsgDTO msgDTO) {
        // wzy 2024-3-21 暂停使用经分助手，将改用腾域短信发送
        //String loginName = propertiesProxy.get("opa.sms.secret-id");
        //String password = propertiesProxy.get("opa.sms.secret-key");
        //String enable  = propertiesProxy.get("opa.sms.enable");
        //if(enable.equals("false")) return null;
        //
        //SendSmsApi sendSmsApi = SendSmsApi.getInstance(loginName, password);
        //
        //String templateId = msgDTO.getTempId();
        //LinkedList<String> paramList = Lists.newLinkedList();
        //paramList.addAll(msgDTO.getTemplateParamList());
        //
        //Set<String> phoneNumSet = Sets.newHashSet(msgDTO.getPhoneNumberSet());
        //
        //SmsResponse<MessageSendResVo> response = sendSmsApi.sendHasVar(templateId, paramList, phoneNumSet);
        //if (response.getCode() == 200) {
        //    return 1;
        //}
        //return 0;
        return tenYuSmsService.tenYuSendMessage(msgDTO);
    }
}
